package y23.Jun;

public class Test22 {
    public static long getNine(long ret){
        long sum = 0;
        int count = 0;
        for(int i = 0;i < 9;i++){
            ret %= 10;
            sum += ret * Math.pow(10,count);
            count++;
        }
        return sum;
    }
    public static long fun1(long n){
        long ret = n ;
        for(n = n - 1;n > 0;n--){
            if(ret % 1000000000 > 1){
                getNine(ret);
            }
                ret *= n;
        }
        return ret;
    }

    public static void main(String[] args) {
        long n = 19L;
        long sum = 0L;
        for(;n < 20;n++){
            sum  += fun1(n);
            System.out.println(fun1(n));
            System.out.println(sum);
            System.out.println("---------------------");
        }
    }
}
